﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace AUV5.Web
{
    public partial class Error : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Exception objErr = Server.GetLastError();
                if (objErr != null)
                {
                    objErr = objErr.GetBaseException();

                    string err = "Error in:" + Request.Url.ToString() +
                            "<br><br>Error Message:" + objErr.Message.ToString() +
                            "<br><br>Stack Trace:" + objErr.StackTrace.ToString();

                    //System.Diagnostics.EventLog.WriteEntry("Sample_WebApp", err, System.Diagnostics.EventLogEntryType.Error);

                    Server.ClearError();

                    //additional actions...

                    //将错误信息写入log日志
                    AUV5.Common.PageBase.log.Error(err, objErr);

                    //
                    this.labErrorMessage.Text = err;
                }
                else
                {
                    this.labErrorMessage.Text = "请不要直接跳转至本页";
                }
            }
        }
    }
}